package com.gqb.ssm.mapper;

import com.gqb.ssm.pojo.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.mybatis.spring.annotation.MapperScan;

import java.util.List;
import java.util.Map;

/**
 * Created by 小泽玛丽罗 on 2016/11/13.
 */
@MapperScan
public interface UserMapper {
    User getOneByOne(int id);
    public  int add(User user);

    public  int deleteById(int id);

    public  User getById(int id);

    public List<User> getAll();

    public int update(User user);

    @Select(value = "select * from users where id=#{id}")
    @ResultType(User.class)
    public User getUserAno(int id);
    public  List<User> getUserAnoParam(@Param("userName") String name);
    public User findByGradeId(int id);

    /**
     * 要注明参数名
     * @param userName
     * @return
     */
    public List<User> ifName(@Param("userName") String userName);
    public List<User> ifNameParamMap(Map<String, Object> map);

    public List<User> chooseWhen(Map<String, Object> map);
    public List<User> where(Map<String, Object> map);
    public List<User> trim(Map<String, Object> map);

    public List<User> foreach(Map<String, Object> map);
    public void set(User user);
    List<User> page(Map<String, Object> map);

    public User login(User user);

}
